/**
 * @从终端数输入一个数字，用英语显示
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>

int main(int argc, char *argv[]) {
	int number, i=0;
	int digits[10];
	char* words[10] = {"zero","one", "two","three","four","five","six","seven","eight","nine"};
	char s;
	bool a=false;

	printf("请输入一个数字：");
	number = GetInt();

	if (number < 0) {
		a = true;
		number = -number;
	} else if (number == 0) {
		digits[i++] = 0;
	}

	while (number > 0){
		digits[i++] = number % 10;
		number = number / 10;
	}

	if (a == true) {
		printf("-");
	}

	for (--i; i>=0; --i) {
		printf("%s ", words[digits[i]]);
	}	

	printf("\n");

	return 0;
}
